package com.android.twitter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import android.text.format.DateUtils;

public class Status {
	String create_at;
	String text;
	User user;
	String id;
	String datetime;
	
	static SimpleDateFormat sdf = new SimpleDateFormat("yyyy MM, dd, z HH:mm:ss", Locale.KOREA);
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getCreate_at() {
		return create_at;
	}
	public void setCreate_at(String createAt) {
		create_at = createAt;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	
	public String getDatetime(){
		return datetime;
	}
	
	public long getCreatedAtMillis(String date){
						
		try{
			Date d = sdf.parse(date);
			return d.getTime();
		}catch(ParseException e){
			return 0L;
		}		
	}
	
	public String getRelativeCreatedAt(String date){
		return DateUtils.getRelativeTimeSpanString(getCreatedAtMillis(date), 
				System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS).toString();		
	}
}